from typing import List, Dict, Any
from intelli_port.config.loader import load_yaml_config


_store: List[Dict[str, Any]] = []


def refresh_from_config(path: str = "config/announcements.yaml") -> None:
    data = load_yaml_config(path) or {}
    items = data.get("announcements") or []
    global _store
    _store = list(items)


def get_system_announcements() -> List[Dict[str, Any]]:
    if not _store:
        refresh_from_config()
    return _store